#pragma once

#include "IXButtonDraw.h"
#include "Logic/Include/XBaseObjImpl.h"


class CXButtonDrawImpl : public CXBaseObjImpl<IXButtonDraw>
{
    typedef CXBaseObjImpl<IXButtonDraw> superclass;

    BEGIN_DEF_SKIN_CLASS(CXButtonDrawImpl, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXButtonDraw, 0)
        IMP_BASIC_INTF(IXDraw, eIntf_NoCreate)
        END_DEF_SKIN_CLASS();
public:
    CXButtonDrawImpl();
    virtual ~CXButtonDrawImpl();

public:
    // IXButtonDraw
    virtual HRESULT STDMETHODCALLTYPE   put_ImagePath(IN LPCTSTR szXNC);
    virtual HRESULT STDMETHODCALLTYPE   put_Icon(IN LPCTSTR szXNC, BOOL bBig);
    virtual HRESULT STDMETHODCALLTYPE   put_Icon(IN XICON xIcon, IN BOOL bDestroy);

    virtual HRESULT STDMETHODCALLTYPE   get_ImagePath(OUT BSTR* pbstrXNC);

    virtual HRESULT STDMETHODCALLTYPE   put_Image(IN XIMAGE xImage);

    virtual void    STDMETHODCALLTYPE   put_DrawType(IN ImageDrawType type);

    virtual HRESULT STDMETHODCALLTYPE   put_DrawParams(IN ImageDrawParams* pParam);
    virtual HRESULT STDMETHODCALLTYPE   get_DrawParams(OUT ImageDrawParams* pParam);

    virtual HRESULT STDMETHODCALLTYPE   get_ImageSize(OUT LPSIZE lpSize);

    virtual HRESULT STDMETHODCALLTYPE   put_Index(IN INT nHIndex, IN INT nVIndex);
    virtual HRESULT STDMETHODCALLTYPE   get_Index(IN LPINT pnHIndex, IN LPINT pnVIndex);

    virtual HRESULT STDMETHODCALLTYPE   put_SubCount(IN INT nHCount, IN INT nVCount);
    virtual HRESULT STDMETHODCALLTYPE   get_SubCount(IN LPINT pnHCount, IN LPINT pnVCount);

    virtual HRESULT STDMETHODCALLTYPE   IsImageValid(OUT LPBOOL pbValid);

    virtual HRESULT STDMETHODCALLTYPE   put_AlphaMode(IN eImageAlphaMode nAlphaMode);
    virtual HRESULT STDMETHODCALLTYPE   get_AlphaMode(OUT eImageAlphaMode* pnAlphaMode);

    virtual HRESULT STDMETHODCALLTYPE   put_AlphaValue(IN BYTE byAlphaValue);
    virtual HRESULT STDMETHODCALLTYPE   get_AlphaValue(OUT LPBYTE pbyAlphaValue);

    virtual HRESULT STDMETHODCALLTYPE   put_TransparentColor(IN COLORREF clrTrans);
    virtual HRESULT STDMETHODCALLTYPE   get_TransparentColor(OUT LPCOLORREF pclrTrans);

    virtual HANDLE  STDMETHODCALLTYPE   GetDrawBuffer(IN SIZE* pSize);
    virtual void    STDMETHODCALLTYPE   ReleaseDrawBuffer(IN HANDLE hBuffer);
    virtual HRESULT STDMETHODCALLTYPE   DrawBuffer(IN XCANVAS xCanvas, IN HANDLE hBuffer, IN const RECT* lpDes);

    // IXDraw
    virtual HRESULT STDMETHODCALLTYPE   Draw(IN XCANVAS xCanvas, const RECT* lpDes);
    virtual HRESULT STDMETHODCALLTYPE   Draw(IN XCANVAS xCanvas, IN const RECT* lpSrc, IN const RECT* lpDes);
    virtual BOOL    STDMETHODCALLTYPE   IsDrawValid();

    virtual void    STDMETHODCALLTYPE   EnableColorize(IN BOOL bEnable);
    virtual void    STDMETHODCALLTYPE   Colorize(IN int hue, IN int sat, IN int light);

    // IBaseObj
    virtual void    STDMETHODCALLTYPE   OnFinalRelease();

protected:
    // CXButtonDrawImpl
    void    ReleaseData();

protected:
    IXImageDraw*    m_pImageDraw;
};


